//Fig. 3.17: Dialog1.java
//Using JOptionPane to display multiple lines in a dialog box.

import javax.swing.JOptionPane; // import class JOptionPane

public class DialogMain {
    public static void main ( String[] args )
    {
        // display a dialog with a message
        JOptionPane.showMessageDialog( null, "Welcome\nto\nJava" );

        // prompt user to enter name
        String name =
                JOptionPane.showInputDialog( "What is your name?" );
        // create the message
        String message =
                String.format( "Welcome, %s, to Java Programming!", name );
        // display the message to welcome the user by name
        JOptionPane.showMessageDialog( null, message );
    } // end main

} // end class Dialog1